<?php
/**
 * Copyright © 2016 SW-THEMES. All rights reserved.
 */

?>
<?php
/**
 * Top menu for store
 *
 * @see \Smartwave\Megamenu\Block\Topmenu
 */
?>
<?php
    $_helper = $this->helper('Smartwave\Megamenu\Helper\Data');
    $_config = $_helper->getConfig('sw_megamenu');
    $columnsLimit = 0;
    $header_type = $_helper->getConfig('porto_settings/header/header_type');
    
    if($_config['general']['enable']) {
?>
<?php $_menu = $block->getMegamenuHtml(); ?>

<nav class="navigation sw-megamenu <?php if($header_type == 8 || $header_type == 10): ?>side-megamenu<?php endif; ?>" role="navigation">
    <ul>
        <?php echo $_menu; ?>
    </ul>
</nav>

<script type="text/javascript">
    require([
        'jquery',
        'Smartwave_Megamenu/js/sw_megamenu'
    ], function ($) {
        $(".sw-megamenu").swMegamenu();
    });
</script>
<?php
    } else {
?>
<?php $_menu = $block->getHtml('level-top', 'submenu', $columnsLimit); ?>

<nav class="navigation sw-megamenu" role="navigation">
    <ul data-mage-init='{"menu":{"responsive":true, "expanded":true, "position":{"my":"left top","at":"left bottom"}}}'>
        <?php /* @escapeNotVerified */ echo $_menu; ?>
    </ul>
</nav>

<?php
    }
?>